<?php
Yii::import('ext.qtip.QTip');
QTip::qtip('span[title]');
?>
<div style="width:100%; float:left; margin-bottom:10px; text-align:right;">
<form action="" method="post" name="batch" id="batch">	
	<table cellspacing="0" cellpadding="0" width="100%" class="tbl" style="float:left;">
		<tr class="head">
			<td width="2%"><input type="checkbox" name="checkAll" id="checkAll"></td>
			<td width="8%">产品编号</td>
			<td width="12%">产品细节</td>
			<td>图片地址</td>
		</tr>
		<?php
		$i = 0;
		$cssArr = array(0 => 'even', 1 => 'odd', 2 => 'three');
		foreach ($rowTable as $item) {
			for($j=1;$j<=20;$j++){
				$field = 'URL'.$j;
				if($item->$field){
					$trClass = $cssArr[$i % 3];
					$i++;
		?>
		<tr class="<?= $trClass ?>">
			<td style="text-align:center;"><input type="checkbox" name="url[]" id="<?=$item->$field?>" value="<?=$item->$field?>"></td>
			<td>
				<span title="<?=$content?>"><?=$item->ProductNo?></span>
			</td>
			<td>
				<span title="<span style='line-height:20px; font-size:12px;'><?=$item->ProductDetail?></span>"><?=Helper::truncate_utf8_string($item->ProductDetail,5,'')?></span>
			</td>
			<td>
				<?=$item->$field?>
			</td>		
		</tr>
		<?php
				}
			}			
		}
		?>
	</table>
	<div style="text-align:center;"><input type="button" onclick="fxl()" name="importSub" value="更新" /></div>	
</form>
</div>
<script type="text/javascript">
/*<![CDATA[*/
jQuery(function($) {
$(document).on('click','#checkAll',function() {
	var checked=this.checked;
	$("input[name='url\[\]']").each(function() {this.checked=checked;});
});
$(document).on('click', "input[name='url\[\]']", function() {
	$('#url').prop('checked', $("input[name='url\[\]']").length==$("input[name='url\[\]']:checked").length);
});
});
function fxl(){
	document.forms.batch.submit();
}
/*]]>*/
</script>